package com.lab.spring.topic2.messaging;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

/**
 * Created with IntelliJ IDEA.
 * User: bsceran
 * Date: 5/22/13
 * Time: 12:55 PM
 * To change this template use File | Settings | File Templates.
 */
public class CheckoutListener implements ApplicationListener {
    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if(applicationEvent instanceof CheckoutEvent) {
            CheckoutEvent checkoutEvent = (CheckoutEvent) applicationEvent;
            System.out.println("Checkout received: ");
            System.out.println("Amount : " + checkoutEvent.getAmount());
            System.out.println("Time   : " + checkoutEvent.getTime().toString());
        }
    }
}
